package leetcode;

/**
 * @program: datastructureandalogorithm
 * @description:
 * @author: hmx
 * @create: 2021-10-28 15:33
 **/
public class LeetCode154 {

    public int findMin(int[] nums) {
        int low = 0;
        int high = nums.length - 1;
        while (low < high) {
            int avg = low + high >> 1;
            if (nums[avg] < nums[high]) {
                high = avg;
            } else if (nums[avg] > nums[high]) {
                low = avg + 1;
            } else {
                high--;
            }
        }
        return nums[low];
    }

}
